package org.jeecg.trace.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.trace.dto.MesMaterialSetDTO;
import org.jeecg.trace.entity.MesMaterialSet;
import org.jeecg.trace.mapper.MesMaterialSetMapper;
import org.jeecg.trace.service.IMesMaterialSetService;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Description: 物料工件关联表
 * @Author: shaolong
 * @Date:   2022-10-26
 * @Version: V1.0
 */
@Service
public class MesMaterialSetServiceImpl extends ServiceImpl<MesMaterialSetMapper, MesMaterialSet> implements IMesMaterialSetService {

	@Autowired
	private MesMaterialSetMapper mesMaterialSetMapper;

	@Override
	public List<MesMaterialSet> selectByMainId(String mainId) {
        return mesMaterialSetMapper.selectByMainId(mainId);
    }

    @Override
    public Result<String> edit(MesMaterialSet mesMaterialSet) {
        LambdaUpdateWrapper<MesMaterialSet> eq = new LambdaUpdateWrapper<MesMaterialSet>();
        //eq.eq(MesMaterialSet::getRecId, qisMatdetailCfg.getRecId());
        boolean update = update(mesMaterialSet, eq);
        return update ? Result.ok("修改成功!") : Result.error("修改失败!");
    }

    @Override
    public IPage<MesMaterialSetDTO> listMesMaterialSetProduct(Page<MesMaterialSetDTO> page, Map<String, String> param) {
        return mesMaterialSetMapper.listMesMaterialSetProduct(page, param);
    }
}
